package f_genericity;

import java.util.ArrayList;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package f_genericity
 * @date 2024/4/8 下午2:21
 */
public class Test01 {
    public static void main(String[] args) {
        ArrayList<Object> list = new ArrayList<>();
        list.add(0);
        list.add("123");
        list.add(2.5f);
        //获取元素中为String类型的字符串长度
        for (Object o : list) {
            String s=(String)o;
            System.out.println(s.length());
        }

    }
}
